package com.noble.glamour.module.logic.socket.logic.task;

import android.os.Handler;
import android.os.Message;

import com.noble.glamour.module.logic.socket.logic.KeepAliveSocket;

/**
 * Created by Su on 2018/6/8.
 */
public class SocketIoHandler extends Handler {
    public static final int READER_CLOSE = 1;
    public static final int WRITER_CLOSE = 2;
    public static final int IO_ERROR = 3;

    private KeepAliveSocket client;

    public SocketIoHandler(KeepAliveSocket client) {
        this.client = client;
    }

    @Override
    public void handleMessage(Message msg) {
        super.handleMessage(msg);

        switch (msg.what) {
            case READER_CLOSE:
                client.onReadClose();
                break;
            case WRITER_CLOSE:
                client.onWriterClose();
                break;
            case IO_ERROR:
                client.onIOError();
            default:
                break;
        }
    }
}
